<template>
  <div>
    Child1
    <p>
      <!-- dispatch是触发异步 -->
      <button @click="onMinus">异步减-2</button>&nbsp; &nbsp;
      <!-- commit是触发同步 -->
      <button @click="onAdd">同步+3</button>
    </p>
  </div>
</template>

<script>
export default {
  methods: {
    onMinus () {
      this.$store.dispatch('counter/asyncMinus', 2)
    },
    onAdd () {
      this.$store.commit('counter/add', 3)
    }
  }
}
</script>
